<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue.js demo</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="app">
    <input v-model="firstName"/>
    <input v-model="lastName"/>

    <div>欢迎: {{fullName}}</div>
    <input v-model="fullName"/>

</div>
</body>

<script>
    new Vue({
        el: '#app',
        data() {
            return {
                firstName: 'helen',
                lastName: 'yao'
            }
        },
        methods:{

        },
        computed:{
            // fullName() {
            //     console.log("full name...")
            //     return this.firstName + '-' + this.lastName;
            // }

            fullName:{
                get() {
                    console.log('full name get...')
                    return this.firstName + '-' + this.lastName
                },
                set(data) {
                    console.log(data + '...')
                    const strings = data.toString().split('-');
                    console.log(strings)
                    this.firstName = strings[0];
                    this.lastName = strings[1];
                }
            }
        }
    })

</script>
</html>
